﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class qiyerencaiku : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["com"] == null)
            {
                Label21.Text = "<script> alert('你没有权限！请先登录！');window.location.href='ComDefault.aspx';</script>";
                return;
            }
            else
            {
                if (Session["isvip"].ToString() == "是")
                {
                    bindtogridview1();
                    MultiView1.ActiveViewIndex = 0;
                }
                else
                {
                    MultiView1.ActiveViewIndex = 1;
                    bindtogridview2();
                }
            }
         //   bindtodatalist();
        }
    }
    public void bindtogridview1()
    {
        DataSet ds = new get().getrencaiku();
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    public void bindtogridview2()
    {
        DataSet ds = new get().getrencaiku();
        GridView2.DataSource = ds;
        GridView2.DataBind();
    }
 
    protected void Button1_Click(object sender, EventArgs e)
    {
        bindrencaisousuo();
    }
    public void bindrencaisousuo()
    {
        string age = tbxage.Text.Trim();

        string strkey = "";
        string xueli = tbxxueli.Text.Trim();
        string zhuanye = tbxzhuanye.Text.Trim();
        string xuexiao = tbxschool.Text.Trim();
        if (age == "")
            age = "-1";
        strkey = "select pid,pname,psex,page,pzy,pmz,pzzface,padd,phouseholder,ptel,pemail,pschool,pknowledge from tb_person where page=" + Convert.ToInt32(age) + " or pknowledge='" + xueli + "' or pzy='" + zhuanye + "' or pschool='" + xuexiao + "'";
        DataSet ds = new get().getrencaisousuo(strkey);
        if (Session["isvip"].ToString() == "是")
        {
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        else
        {
            GridView2.DataSource = ds;
            GridView2.DataBind();
        }


    }
    protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView2.PageIndex = e.NewPageIndex;
        bindtogridview2();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        bindtogridview1();
    }
}
